package f5transformation;

import flinkemp.Emp;
import flinkemp.EmpFun;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Map1Sal {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        DataStreamSource<Emp> data = env.addSource(new EmpFun());
        data.print();
        SingleOutputStreamOperator<String> sal = data.map(new MapFunction<Emp, String>() {
            @Override
            public String map(Emp emp) throws Exception {
                return "薪资:" + emp.sal;
            }
        });
        sal.print();
        env.execute();
    }
}
